import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '../views/Login.vue'
import LoginApp from '../views/LoginApp.vue'
import LoginTv from '../views/LoginTv.vue'
import Main from '../views/Main.vue'
import Summary from '../views/Summary.vue'
import List from '../views/List.vue'
import ListArea from '../views/ListArea.vue'
import ListTV from '../views/ListTV.vue'
import ListTvComplex from '../views/byg/tv/ListTvComplex.vue'
import ListComplex from '../views/ListComplex.vue'
import ListDouble from '../views/ListDouble.vue'
import tabMain from '../views/byg/tabMain.vue'
import Account from '../views/user/Account.vue'
import Role from '../views/user/role.vue'
import CommonPrint from '../views/common/print/CommonPrint.vue'
import Cemetery from '../views/gm/Cemetery.vue'
import CemeterySet from '../views/gm/CemeterySet.vue'
import extendUrl from '../views/iframe/extendUrl.vue'
import optionSet from '../views/common/OptionSet.vue'
import dutyCalendar from '../views/common/duty/dutyCalendar.vue'
import Chart from '../views/list/Chart.vue'
import ChartMain from '../views/list/ChartMain.vue'
import DesktopList from '../views/list/DesktopList.vue'
import Cold from '../views/byg/cold.vue'
import CrematedScan from '../views/byg/crematedScan.vue'
import asheScan from '../views/byg/asheScan.vue'
import storager from '../views/byg/storager.vue'
import Room from '../views/byg/Room.vue'
import PrintSet from '../views/common/print/PrintSet.vue'
import CemeteryJc from '../views/gm/CemeteryJc.vue'
import test from '../views/test.vue'
import viewer from '../views/viewer.vue'
//import ytjMain from '../views/ytj/Main.vue'
//import ytjList from '../views/ytj/ListYtj.vue'
//import ytjEdit from '../views/ytj/commonEdit.vue'
//import ytjListChild from '../views/ytj/ListChild.vue'
import MainChild from '../views/ytj/MainChild.vue'
//import ytjChartReport from '../views/ytj/ytjChartReport.vue'
//import ytjView from '../views/ytj/View.vue'
import ytjMobileMain from '../views/ytjmobile/Main.vue'
import ytjMobileMainChild from '../views/ytjmobile/MainChild.vue'
import ytjMobileList from '../views/ytjmobile/ListYtjMobile.vue'
import ytjMobileLogin from '../views/ytjmobile/LoginApp.vue'
import ltView from '../views/byg/lttv/LtView.vue'
import lygTest from '../views/byg/lygTest.vue'

Vue.use(VueRouter)

  const routes = [
  {
    path: '/',
    name: 'App',
    redirect:'/login'
    //component: Login
  },
  {
		path: '/gps',
		name: 'gps',
		component: () => import('../views/common/gps/GPS'),
		meta: {
			
		}
	},
  {
		path: '/loginHm',
		name: 'loginHm',
		component: () => import('../views/loginHm'),
		meta: {
			
		}
	},
  {
		path: '/amap',
		name: 'amap',
		component: () => import('../views/common/gps/Amap'),
		meta: {
			
		}
	},
  {
		path: '/mainMetro',
		name: 'mainMetro',
		component: () => import('../views/MainMetro'),
		meta: {
			
		}
	},
  {
		path: '/mainMetroApp',
		name: 'mainMetroApp',
		component: () => import('../views/MainMetroApp'),
		meta: {
			
		}
	},
  {
		path: '/mainMetroSimple',
		name: 'mainMetroSimple',
		component: () => import('../views/MainMetroSimple'),
		meta: {
			
		}
	},
  {
		path: '/LtTv',
		name: 'LtTv',
		component: () => import('../views/byg/lttv/LtTv.vue'),
		meta: {
			
		}
	}, 
  {
		path: '/editor',
		name: 'editor',
		component: () => import('../components/edit/editor.vue'),
		meta: {
			
		}
	},
  {
		path: '/error_token',
		name: 'error_token',
		component: () => import('../views/error/token.vue'),
		meta: {
			
		}
	},
  {
    path: '/login', 
    name: 'Login',
    component: Login,
  },
  {
    path: '/mobileChart', 
    name: 'mobileChart',
    component: () => import('../views/ytjmobile/mobileChart.vue'),
  },
  {
    path: '/ytjLogin', 
    name: 'ytjLogin',
    component: () => import('../views/ytj/LoginApp.vue'),
  },{
    path: '/mainMobile', 
    name: 'mainMobile',
    component: () => import('../views/mobiles/MainMobile.vue'),
    meta:{
      isLogin:true    // 添加该字段，表示进入这个路由是需要登录的
    }
  },{
    path: '/ytjMain', 
    name: 'ytjMain',
   // component: ytjMain,
    component: () => import('../views/ytj/Main.vue'),
    meta:{
      isLogin:true    // 添加该字段，表示进入这个路由是需要登录的
    }
  },{
    path: '/ytjView', 
    name: 'ytjView',
    //component: ytjView,
    component: () => import('../views/ytj/View.vue'),
    meta:{
      isLogin:true    // 添加该字段，表示进入这个路由是需要登录的
    }
  },{
    path: '/ytjChartReport', 
    name: 'ytjChartReport',
    //component: ytjChartReport,
    component: () => import('../views/ytj/ytjChartReport.vue'),
    meta:{
      isLogin:true    // 添加该字段，表示进入这个路由是需要登录的
    }
  },{
    path: '/ytjList', 
    name: 'ytjList',
    //component: ytjList,
    component: () => import('../views/ytj/ListYtj.vue'),
    meta:{
      isLogin:true    // 添加该字段，表示进入这个路由是需要登录的
    }
  },{
    path: '/ytjEdit', 
    name: 'ytjEdit',
    //component: ytjEdit,
    component: () => import('../views/ytj/commonEdit.vue'),
    meta:{
      isLogin:true    // 添加该字段，表示进入这个路由是需要登录的
    }
  },{
    path: '/ytjListChild', 
    name: 'ytjListChild',
    //component: ytjListChild,
    component: () => import('../views/ytj/ListChild.vue'),
    meta:{
      isLogin:true    // 添加该字段，表示进入这个路由是需要登录的
    }
  },{
    path: '/mainChild', 
    name: 'mainChild',
    component: MainChild,
    meta:{
      isLogin:true    // 添加该字段，表示进入这个路由是需要登录的
    }
  },{
    path: '/ytjMobileLogin', 
    name: 'ytjMobileLogin',
    component: ytjMobileLogin,
  },{
    path: '/ytjMobileMain', 
    name: 'ytjMobileMain',
    component: ytjMobileMain,
    meta:{
      isLogin:true    // 添加该字段，表示进入这个路由是需要登录的
    }
  },{
    path: '/ytjMobileMainChild', 
    name: 'ytjMobileMainChild',
    component: ytjMobileMainChild,
    meta:{
      isLogin:true    // 添加该字段，表示进入这个路由是需要登录的
    }
  },{
    path: '/ytjMobileList', 
    name: 'ytjMobileList',
    component: ytjMobileList,
    meta:{
      isLogin:true    // 添加该字段，表示进入这个路由是需要登录的
    }
  },
  {
    path: '/loginApp',
    name: 'LoginApp',
    component: LoginApp,
  },
  {
    path: '/loginTv',
    name: 'LoginTv',
    component: LoginTv,
  },
  {
    path: '/test',
    name: 'test',
    component: test,
  },
  {
    path: '/viewer',
    name: 'viewer',
    component: viewer,
  }, {
    path: '/main',
    name: 'Main',
    component: Main,
    meta:{
      isLogin:true    // 添加该字段，表示进入这个路由是需要登录的
    }
  }, {
    path: '/summary',
    name: 'Summary',
    component: Summary
  },{
    path: '/listTV',
    name: 'listTV',
    component: ListTV,
    meta:{
      isLogin:true    // 添加该字段，表示进入这个路由是需要登录的
    }
  },{
    path: '/listTvComplex',
    name: 'ListTvComplex',
    component: ListTvComplex,
    meta:{
      isLogin:true    // 添加该字段，表示进入这个路由是需要登录的
    }
  },{
    path: '/list',
    name: 'List',
    component: List
  },{
    path: '/chart',
    name: 'Chart',
    component: Chart,
    meta:{
      isLogin:true    // 添加该字段，表示进入这个路由是需要登录的
    }
  },{
    path: '/chartMain',
    name: 'ChartMain',
    component: ChartMain,
    meta:{
      isLogin:true    // 添加该字段，表示进入这个路由是需要登录的
    }
  },{
    path:'/listComplex',
    name: 'ListComplex',
    component: ListComplex,
    meta:{
      isLogin:true    // 添加该字段，表示进入这个路由是需要登录的
    }
  },{
    path:'/listDouble',
    name: 'ListDouble',
    component: ListDouble,
    meta:{
      isLogin:true    // 添加该字段，表示进入这个路由是需要登录的
    }
  },{
    path: '/commonEdit',
    name: 'CommonEdit',
    component: resolve=>(require(["../views/CommonEdit.vue"],resolve)),
    meta:{
      isLogin:true    // 添加该字段，表示进入这个路由是需要登录的
    }
  },{
    path: '/bygScan',
    name: 'bygScan',
    component: resolve=>(require(["../views/byg/bygScan.vue"],resolve)),
    meta:{
      isLogin:true    // 添加该字段，表示进入这个路由是需要登录的
    }
  },{
    path: '/byg/tabMain',
    name: 'tabMain',
    component: tabMain,
    meta:{
      isLogin:true    // 添加该字段，表示进入这个路由是需要登录的
    },
    children:[
      {
        path: 'scaneView',
        name: 'scaneView',
        component: () => import('../views/common/scaneView'),
        meta: {
          
        }
      },
      {
        path: 'gmMap',
        name: 'gmMap',
        component: () => import('../views/common/gps/GmMap'),
        meta: {
          
        }
      },
      {
        path: 'gps',
        name: 'gps',
        component: () => import('../views/common/gps/GPS'),
        meta: {
          
        }
      },
      {
        path: 'carMap',
        name: 'carMap',
        component: () => import('../components/edit/CarMap'),
        meta: {
          
        }
      },
      {
        path: 'log',
        name: 'log',
        component: () => import('../views/log/log.vue'),
        meta: {
          
        }
      },
      {
        path: 'printSelect',
        name: 'printSelect',
        component: () => import('../views/common/print/PrintSelect.vue'),
        meta: {
          
        }
      },
      {
        path: 'ltView',
        name: 'ltView',
        component: ltView,
        meta: {
          
        }
      },
      {
        path: 'lygTest',
        name: 'lygTest',
        component: lygTest,
        meta: {
          
        }
      },
      {
        path: 'desktopList',
        name: 'desktopList',
        component: DesktopList,
        meta:{
          keepAlive:true,
          isLogin:true    // 添加该字段，表示进入这个路由是需要登录的
        }
      },
      {
        path: 'list',
        name: 'ListByg',
        component: List,
        meta:{
          keepAlive:true,
          isLogin:true    // 添加该字段，表示进入这个路由是需要登录的
        }
      },
      {
        path: 'listArea',
        name: 'ListArea',
        component: ListArea,
        meta:{
          keepAlive:true,
          isLogin:true    // 添加该字段，表示进入这个路由是需要登录的
        }
      },
      {
        path:'listComplex',
        name: 'ListComplexByg',
        component: ListComplex,
        meta:{
          keepAlive:true,
          isLogin:true    // 添加该字段，表示进入这个路由是需要登录的
        }
      },{
        path:'listDouble',
        name: 'ListDoubleByg',
        component: ListDouble,
        meta:{
          keepAlive:true,
          isLogin:true    // 添加该字段，表示进入这个路由是需要登录的
        }
      },
      {
        path: 'commonPrint',
        name: 'CommonPrintByg',
        component: CommonPrint,
        meta:{
          keepAlive:false,
          isLogin:true    // 添加该字段，表示进入这个路由是需要登录的
        }
      },{
        path: 'commonEdit',
        name: 'CommonEditByg',
        component: resolve=>(require(["../views/CommonEdit.vue"],resolve)),
        meta:{
          keepAlive:true,
          isLogin:true    // 添加该字段，表示进入这个路由是需要登录的
        }
      },{
        path: 'commonView',
        name: 'commonView',
        component: resolve=>(require(["../views/CommonView.vue"],resolve)),
        meta:{
          keepAlive:true,
          isLogin:true    // 添加该字段，表示进入这个路由是需要登录的
        }
      }
      ,{
        path: 'cemetery',
        name: 'CemeteryByg',
        component: Cemetery,
        meta:{
          keepAlive:true,
          isLogin:true    // 添加该字段，表示进入这个路由是需要登录的
        }
      },{
        path: 'cemeterySet',
        name: 'cemeterySet',
        component: CemeterySet,
        meta:{
          keepAlive:true,
          isLogin:true    // 添加该字段，表示进入这个路由是需要登录的
        }
      },{
        path: 'cemeterySet2',
        name: 'cemeterySet2',
        component: resolve=>(require(["../views/gm/CemeterySet2.vue"],resolve)),
        meta:{
          keepAlive:true,
          isLogin:true    // 添加该字段，表示进入这个路由是需要登录的
        }
      },{
        path: 'cemeteryJc',
        name: 'cemeteryJc',
        component: CemeteryJc,
        meta:{
          keepAlive:true,
          isLogin:true    // 添加该字段，表示进入这个路由是需要登录的
        }
      },{
        path: 'extendUrl',
        name: 'extendUrl',
        component: extendUrl,
        meta:{
          keepAlive:true,
          isLogin:false    // 添加该字段，表示进入这个路由是需要登录的
        }
      },{
        path: 'optionSet',
        name: 'optionSet',
        component: optionSet,
        meta:{
          keepAlive:true,
          isLogin:true    // 添加该字段，表示进入这个路由是需要登录的
        }
      },{
        path: 'dutyCalendar',
        name: 'dutyCalendar',
        component: dutyCalendar,
        meta:{
          keepAlive:true,
          isLogin:true    // 添加该字段，表示进入这个路由是需要登录的
        }
      },{
        path: 'cold',
        name: 'cold',
        component: Cold,
        meta:{
          keepAlive:true,
          isLogin:true    // 添加该字段，表示进入这个路由是需要登录的
        }
      },{
        path: 'room',
        name: 'room',
        component: Room,
        meta:{
          keepAlive:true,
          isLogin:true    // 添加该字段，表示进入这个路由是需要登录的
        }
      },{
        path: 'printSet',
        name: 'PrintSet',
        component: PrintSet,
        meta:{
          keepAlive:true,
          isLogin:true    // 添加该字段，表示进入这个路由是需要登录的
        }
      },{
        path: 'crematedScan',
        name: 'crematedScan',
        component: CrematedScan,
        meta:{
          keepAlive:true,
          isLogin:true    // 添加该字段，表示进入这个路由是需要登录的
        }
      },{
        path: 'asheScan',
        name: 'asheScan',
        component: asheScan,
        meta:{
          keepAlive:true,
          isLogin:true    // 添加该字段，表示进入这个路由是需要登录的
        }
      },{
        path: 'storager',
        name: 'storager',
        component: storager,
        meta:{
          keepAlive:true,
          isLogin:true    // 添加该字段，表示进入这个路由是需要登录的
        }
      },{
        path: 'role',
        name: 'role',
        component: Role,
        meta:{
          keepAlive:true,
          isLogin:true    // 添加该字段，表示进入这个路由是需要登录的
        }
      },
      {
        path: 'pay',
        name: 'pay',
        component: () => import('../components/common/pay'),
        meta: {
          
        }
      }
      
    ]
  },{
    path: '/ltPhoto',
    name: 'ltPhoto',
    component: () => import('../views/lt/LtPhoto'),
    meta: {
      
    }
  },{
    path: '/account',
    name: 'Account',
    component: Account,
    meta:{
      isLogin:true    // 添加该字段，表示进入这个路由是需要登录的
    }
  },{
    path: '/commonPrint',
    name: 'CommonPrint',
    component: CommonPrint,
    meta:{
      isLogin:true    // 添加该字段，表示进入这个路由是需要登录的
    }
  },{
    path: '/cemetery',
    name: 'Cemetery',
    component: Cemetery,
    meta:{
      isLogin:true    // 添加该字段，表示进入这个路由是需要登录的
    }
  },{
    path: '/cemeteryJc',
    name: 'cemeteryJc',
    component: CemeteryJc,
    meta:{
      isLogin:true    // 添加该字段，表示进入这个路由是需要登录的
    }
  },{
    path: '/cemeterySet2',
    name: 'cemeterySet2',
    component: resolve=>(require(["../views/gm/CemeterySet2.vue"],resolve)),
    meta:{
      isLogin:true    // 添加该字段，表示进入这个路由是需要登录的
    }
  },
]

const router = new VueRouter({
  //mode: 'history',
  //base: process.env.BASE_URL,
  base:"/",
  routes,
  scrollBehavior (to, from, savedPosition) {
    if (savedPosition) {
      return savedPosition
    } else {
      if (from.meta.keepAlive) {
        from.meta.savedPosition = document.body.scrollTop // 此处为记录的滚动条位置
      }
      return { x: 0, y: to.meta.savedPosition || 0 }
    }
  }
})

export default router
